if(!IsPC()){
		window.location.replace("phone/index.html");
		let exception = new CommonException('检测到手机', 1);
        throw exception
	}
	
	var VueUI = new Vue({
		el: '#app',
		methods: {
		     
			uploadClick(){
				const loading = VueUI.$loading({
					lock: true,
					text: '正在上传',
					spinner: 'el-icon-loading',
					background: 'rgba(0, 0, 0, 0.5)'
				});
				var fileInput = $("<input type='file'></input>")
				fileInput.bind("change", function () {
					file = fileInput[0].files[0];
					$.MdManager.upLoadFC(file,function(flag,file){
						loading.close()
						if(flag){
							VueUI.$notify({
								title: '提示',
								message: '上传文件成功',
								type: 'success'
							});
						}else{
							this.$notify.error({
								title: '错误',
								message: '上传文件失败'
							  });
						}
					})
	
				});
				fileInput.click();
			},
			shareMd(){
				if(this.mdOverWatchData.objectId.isEmpty()){
					VueUI.$message.error("当前文章无法分享");
				}else{
					window.open("share/index.html?data="+getAES(this.mdOverWatchData.objectId)) 
				}
				
			},
			
			cleanCatch() {
				VueAction.cleanCatch()
			},
			showMdPowerName(power) {
				return VueData().userBean.powerList.md.powerLab[parseInt(power)].name
			},
			showNumberPowerName(power) {
				return VueData().userBean.powerList.number.powerLab[parseInt(power)].name
			},
			inputTagType(arr) {
				this.$prompt('请输入标签名称', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					inputPattern: /\S/,
					inputErrorMessage: '不能为空'
				}).then(({ value }) => {
					arr.push({
						name: value,
						type: ''
					})
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '取消输入'
					});
				});
			},
			filterTag(value, row) {
				return row.examine === value;
			},
			AllGroupNumberManager(arg) {
				let tabName
				let fun;
				let mData = new tableData();
				mData.groupId = arg.objectId; //群组id
				mData.groupName = arg.name;
				tabName = '(' + arg.name + ')人员管理(站长)';
				fun = function (that) {
					VueData().userBean.activeWindow.type = 2
					if (that) {
						VueData().userBean.activeWindow.TableBean = that.tableData;
						VueData().userBean.activeWindow.MenuActive = that.id;

					}
				}
				//mData群组人员操作的一些属性
				mData.DbName = $.Encryption.CloudTable.groupNumber
				mData.whereBuilder = function (it) {
					it.DbHelper.equalTo('groupId', it.groupId)
					it.DbHelper.contains('numberName', it.nameinput)
					return it.DbHelper;
				}
				var tabItem = VueAction.addTab(tabName, fun, '10001', mData)
				tabItem.fun(tabItem)
			},
			AllGroupMdManager(arg) {
				let tabName
				let fun;
				let mData = new tableData();
				mData.groupId = arg.objectId; //群组id
				mData.groupName = arg.name;
				tabName = '(' + arg.name + ')文章管理(站长)';
				fun = function (that) {
					VueData().userBean.activeWindow.type = 1
					if (that) {
						VueData().userBean.activeWindow.TableBean = that.tableData;
						VueData().userBean.activeWindow.MenuActive = that.id;
					}
				}
				//mData群组文章操作的一些属性
				mData.DbName = $.Encryption.CloudTable.MdList

				mData.whereBuilder = function (it) {

					it.DbHelper.equalTo('groupId', it.groupId)
					it.DbHelper.contains('name', it.nameinput)
					return it.DbHelper;
				}
				var tabItem = VueAction.addTab(tabName, fun, '10000', mData)
				tabItem.fun(tabItem)
			},
			importLocalMd(bean, editBean) {
				$.MdManager.eventManager().opnelocalFile(function (result, name) {
					editBean.data = result;
					if (editBean.name) {
						editBean.name = name
					} else {
						Vue.set(editBean, 'name', name)
					}
					VueUI.$notify({
						title: '成功',
						message: '导入文章成功',
						type: 'success'
					});

				});
			},
			addMdPost(bean) {
				if (VueAction.isTablEditor(bean.list)) {
					VueUI.$message.error("当前列表有内容正在编辑");
					return
				}
				let itemValue = {
					isSet: true,
					timeString: new Date().Format("yyyy-MM-dd HH:mm"),
					UserId: $.Encryption.user.bean.name
				}
				bean.seletItem = itemValue
				bean.list.unshift(itemValue)
			},

			newGroupMd(bean) {
				if (VueAction.isTablEditor(bean.list)) {
					VueUI.$message.error("当前列表有内容正在编辑");
					return
				}
				let itemValue = {
					isSet: true,
					groupId: bean.groupId,
					groupName: bean.groupName,
					timeString: new Date().Format("yyyy-MM-dd HH:mm")
				}
				bean.seletItem = itemValue
				bean.list.unshift(itemValue)
			},
			getIndex(strat, index, end) {
				return strat + index + end;
			},

			MenueSelect(key, keyPath) {
				replaceCurrentTabData();

				let tabs = VueData().userBean.editableTabs;
				let tab
				for (let i = 0; i < tabs.length; i++) {
					tab = tabs[i];
					if (tab.id == key) {
						VueData().userBean.editableTabsValue = tab.name;
						tab.fun(tab);
						return true;
					}
				}
				let tabName = "列表"
				let fun;
				let mData = new tableData();
				if (key == '3-1') {
					//管理所有成员
					fun = function (that) {
						VueData().userBean.activeWindow.type = 3

						if (that) {
							VueData().userBean.activeWindow.TableBean = that.tableData;
							VueData().userBean.activeWindow.MenuActive = that.id;
						}
					}
					tabName = "管理所有成员"
					mData.DbName = $.Encryption.CloudTable.UserMaster
					mData.whereBuilder = function (it) {
						it.DbHelper.contains('name', it.nameinput)
						return it.DbHelper
					}
					// 
				} else if (key == '1-099') {
					fun = function (that) {
						VueData().userBean.activeWindow.type = 0
						if (that) {
							VueData().userBean.activeWindow.TableBean = that.tableData;
							VueData().userBean.activeWindow.MenuActive = that.id;
						}
					}
					mData.DbName = $.Encryption.CloudTable.MdList
					mData.whereBuilder = function (it) {
						it.DbHelper.equalTo('power', '2')
						it.DbHelper.contains('name', it.nameinput)
						return it.DbHelper
					}
					tabName = "公开文章"
				} else if (key == '3-3') {
					fun = function (that) {
						VueData().userBean.activeWindow.type = 0
						if (that) {
							VueData().userBean.activeWindow.TableBean = that.tableData;
							VueData().userBean.activeWindow.MenuActive = that.id;
						}
					}
					mData.DbName = $.Encryption.CloudTable.MdList
					mData.whereBuilder = function (it) {
						it.DbHelper.contains('name', it.nameinput)
						return it.DbHelper
					}
					tabName = "管理所有文章"
				}else if (key == '3-4') {
					fun = function (that) {
						VueData().userBean.activeWindow.type = 5
						if (that) {
							VueData().userBean.activeWindow.TableBean = that.tableData;
							VueData().userBean.activeWindow.MenuActive = that.id;
						}
					}
					mData.DbName = $.Encryption.CloudTable.cloudFile
					mData.whereBuilder = function (it) {
						return it.DbHelper
					}
					tabName = "管理服务器文件"
				}  else if (key == '3-2') {

					fun = function (that) {
						VueData().userBean.activeWindow.type = 4
						if (that) {
							VueData().userBean.activeWindow.TableBean = that.tableData;
							VueData().userBean.activeWindow.MenuActive = that.id;
						}
					}
					mData.DbName = $.Encryption.CloudTable.groupTable
					mData.whereBuilder = function (it) {
						it.DbHelper.contains('name', it.nameinput)
						return it.DbHelper
					}
					tabName = "管理所有群组"

				} else if (key == '1-100') {
					VueData().Form.creatGroupForm.dialogVisible = true
					return
				} else if (key == '1-200') {
					VueData().Form.joinGroupForm.dialogVisible = true
					return
				} else if (keyPath[0] == '0') {
					fun = function (that) {
						VueData().userBean.activeWindow.type = 0
						if (that) {
							VueData().userBean.activeWindow.TableBean = that.tableData;
							VueData().userBean.activeWindow.MenuActive = that.id;
						}
					}
					//mData所有文章操作的一些属性
					if (key == '0-0') {
						mData.whereBuilder = function (it) {
							it.DbHelper.equalTo('UserId', $.Encryption.user.bean.name)
							it.DbHelper.contains('name', it.nameinput)
							return it.DbHelper
						}
					} else if (key == '0-1') {
						mData.whereBuilder = function (it) {
							it.DbHelper.equalTo('UserId', $.Encryption.user.bean.name)
							it.DbHelper.equalTo('power', '2')
							it.DbHelper.contains('name', it.nameinput)
							return it.DbHelper
						}
					} else if (key == '0-2') {
						mData.whereBuilder = function (it) {
							it.DbHelper.equalTo('UserId', $.Encryption.user.bean.name)
							it.DbHelper.equalTo('power', '0')
							it.DbHelper.contains('name', it.nameinput)
							return it.DbHelper
						}
					}

					tabName = VueData().userBean.leftMenuBean.owerFileTags[parseInt(key.split('-').lastItem())].name;
				} else if (keyPath[0] == '1') {

					if (keyPath.length == 3) {
						VueData().userBean.defultOpeneds[2] = key; //防止菜单缩回
						let CurrentGroup = VueData().userBean.leftMenuBean.myGroups[parseInt(keyPath[1].split('-').lastItem())];
						mData.groupId = CurrentGroup.groupId; //群组id
						mData.groupName = CurrentGroup.groupName;
						if (key.endWith('0')) {
							tabName = '(' + CurrentGroup.groupName + ')人员管理';
							fun = function (that) {
								VueData().userBean.activeWindow.type = 2
								if (that) {
									VueData().userBean.activeWindow.TableBean = that.tableData;
									VueData().userBean.activeWindow.MenuActive = that.id;

								}
							}
							//mData群组人员操作的一些属性
							mData.DbName = $.Encryption.CloudTable.groupNumber
							mData.whereBuilder = function (it) {
								it.DbHelper.equalTo('groupId', it.groupId)
								it.DbHelper.contains('numberName', it.nameinput)
								return it.DbHelper;
							}
						} else {
							tabName = '(' + CurrentGroup.groupName + ')文章管理';
							fun = function (that) {
								VueData().userBean.activeWindow.type = 1
								if (that) {
									VueData().userBean.activeWindow.TableBean = that.tableData;
									VueData().userBean.activeWindow.MenuActive = that.id;
								}
							}
							//mData群组文章操作的一些属性
							mData.DbName = $.Encryption.CloudTable.MdList

							mData.whereBuilder = function (it) {

								it.DbHelper.equalTo('groupId', it.groupId)
								it.DbHelper.contains('name', it.nameinput)
								return it.DbHelper;
							}
						}
					}
				}
				var tabItem = VueAction.addTab(tabName, fun, key, mData)
				tabItem.fun(tabItem)
				console.log(key);
			},
			insertMdEditor(row) {
				VueData().userBean.dialogVisible = false;
				$.MdManager.loadeMarkDown(row);

			},
			loginOut() {
				$.Encryption.user.LoginOut();
				VueAction.cleanCatch()
				VueData().userBean.dialogVisible = false
				this.$message({
					type: 'success',
					message: '注销成功'
				});
			},

			changePwd() {
				VueData().Form.changePwdForm.dialogVisible = true
				VueAction.JsWithVue(function () {
					swipImg.init(document.getElementById('slideImageWrap'), function () {

					})
				})
			},
			acceptUser(row) {
				this.$confirm('审核通过并发送邮件，允许用户重置密码?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					row.examine = '通过'
					row.pwdChangeCode = uuid();
					$.MdManager.newSaveHelper(VueData().userBean.activeWindow.TableBean.DbName)
						.setObj(row).save(function (obj) {
							VueUI.$notify({
								title: '成功',
								message: '更新成功',
								type: 'success'
							});
							const loading = VueUI.$loading({
								lock: true,
								text: '正在发送邮件',
								spinner: 'el-icon-loading',
								background: 'rgba(0, 0, 0, 0.5)'
							});
							setTimeout(() => {
								loading.close();

								VueAction.sendMail(getEmailString(row.name, getAES(row.pwdChangeCode)), row.mail);
								VueUI.$notify({
									title: '提示',
									message: '发送邮件成功',
									type: 'success'
								});
							}, 2000);
						})
				}).catch(() => {

				});

			},
			delect(scope) {
				if (!$.Encryption.power.havePower(scope.row)) {
					VueUI.$message.error("没有权限");
					return
				}

				this.$confirm('此操作将永久删除, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					$.MdManager.newSaveHelper(VueData().userBean.activeWindow.TableBean.DbName).remove(scope.row);
					VueData().userBean.activeWindow.TableBean.list.remove(scope.row)
				}).catch((e) => {
					console.log(e)
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
			nameString(time) {
				return $.MdManager.eventManager().getTime(time)
			},
			handleClose(done) {
				done();
			},
			Pagechange(index) {
				VueData().dialogloading = true;
				$.MdManager.eventManager().loadOPenList(null, index)
			},
			overWatchItem(row) {
				VueData().mdOverWatchEnable = true;
				VueAction.JsWithVue(function () {
					VueData().mdOverWatchData=row;
					$.MdManager.overWatchMd('overMd', row.data)
				})
			},
			editMd(row) {
				VueData().customerBean.dialogVisible = false;

				$.MdManager.loadeMarkDown(row);
			},
			removeTab(targetName) {
				let tabs = VueData().userBean.editableTabs;
				if (tabs.length == 1) {
					VueUI.$notify({
						title: '警告',
						message: '别关了留一个行不行☹',
						type: 'success'
					});
					return
				}
				let activeName = VueData().userBean.editableTabsValue;
				if (activeName === targetName) {
					replaceCurrentTabData();
					tabs.forEach((tab, index) => {
						if (tab.name === targetName) {
							let nextTab = tabs[index + 1] || tabs[index - 1];
							if (nextTab) {
								activeName = nextTab.name;
								nextTab.fun(nextTab)
							}
						}
					});
				}

				VueData().userBean.editableTabsValue = activeName;
				VueData().userBean.editableTabs = tabs.filter(tab => tab.name !== targetName);
			},
			tabClick(tab) {
				let tabs = VueData().userBean.editableTabs;
				let tabItem = tabs[tab.index];
				replaceCurrentTabData();
				tabItem.fun(tabItem);
			},
		},
		data: function () {
			return {
				upload:{
					fileList:[],
					uploadVisiable:false,
					uploadLoading:false
				},
			
				
				iframeDialogVisible:false,
				pwdForm: {
					pass: '',
					checkPass: '',
				},


				nameinput: '',
				dialogVisible: false,
				enableChangePwd: false,
				customerBean: {
					dialogVisible: false,
					queryData: getCustomerTableData()
				},
				dialogloading: false,
				Form: {
					joinGroupForm: {
						dialogVisible: false,
						bean: {
							groupName: '',
							groupId: '',
							numberId: '',
							numberName: '',
						},
						action() {
							let bean = VueData().Form.joinGroupForm.bean;
							if (bean.groupId == '') {
								VueUI.$message.error("请选择群组");
								return
							}
							VueData().Form.joinGroupForm.dialogVisible = false;
							bean.numberId = $.Encryption.user.bean.objectId
							bean.numberName = $.Encryption.user.bean.name
							bean.groupName = VueAction.getGroupNameFromArr(VueData().userBean.allGroups, bean.groupId)
							$.MdManager.newSaveHelper($.Encryption.CloudTable.groupNumber).setObj(bean).save(function (result) {
								VueUI.$notify({
									title: '成功',
									message: '加入群组成功',
									type: 'success'
								});
							})
						}
					},
					creatGroupForm: {
						bean: {
							name: '',
						},
						rules: {
							name: [{
								required: true,
								message: '请填群组名称',
								trigger: 'blur'
							}],
						},
						action: function () {
							VueUI.$refs[VueData().Form.creatGroupForm.ref].validate((valid) => {
								if (valid) {
									$.MdManager.newSaveHelper($.Encryption.CloudTable.groupTable)
										.setObj(VueData().Form.creatGroupForm.bean).save(function (_obj) {
											let data = {
												groupId: _obj.id,
												groupName: VueData().Form.creatGroupForm.bean.name,
												numberName: $.Encryption.user.bean.name,
												numberId: $.Encryption.user.bean.objectId
											}
											var comment = new AV.Object($.Encryption.CloudTable.groupNumber);

											comment.save(data).then(function (result) {

												VueUI.$notify({
													title: '成功',
													message: '添加成功',
													type: 'success'
												});
												VueData().Form.creatGroupForm.dialogVisible = false;
												VueAction.loadGroup();
											})





										})
								} else {
									return false;
								}
							});
						},
						ref: 'Groupbean',
						dialogVisible: false,

					},
					upLoadForm: {
						dialogVisible: false,
						disabled: false,
						isCustomer: true,
						open: "1",
						bean: {
							power: "1",
						},
						action: {
							commit() {
								const loading = showLoading('正在提交.....')
								VueAction.commitEditorMd($.Encryption.getMdData(), function (arg) {
									loading.close()
									VueData().Form.upLoadForm.dialogVisible = false

								})
							}
						}
					},

					forgetPwdForm: {
						bean: {
							name: '',
							mail: null,
						},
						rules: {
							mail: [{
								required: true,
								message: '请输入邮箱地址',
								trigger: 'blur'
							},
							{
								type: 'email',
								message: '请输入正确的邮箱地址',
								trigger: 'blur,change'
							}
							],
							name: [{
								required: true,
								message: '请填写账号',
								trigger: 'blur'
							}],
						},
						ref: 'registerBean',
						dialogVisible: false,
					},
					changePwdForm: {
						resetPwd() {
							VueUI.$refs[VueData().Form.changePwdForm.ref].resetFields();
						},
						submitPwd: function () {
							VueUI.$refs[VueData().Form.changePwdForm.ref].validate((valid) => {
								if (valid) {
									const loading = showLoading('正在验证密码.....')
									VueAction.login($.Encryption.user.bean.name, getMd5(VueData().Form.changePwdForm.bean.pass), function (flag, data) {
										loading.close();
										if (flag) {
											var todo = AV.Object.createWithoutData($.Encryption.CloudTable.UserMaster, $.Encryption.user.bean.objectId);
											todo.set('pwd', getMd5(VueData().Form.changePwdForm.bean.checkPass))
											todo.save();
											VueUI.$notify({
												title: '成功',
												message: '修改密码成功',
												type: 'success'
											});
											VueData().Form.changePwdForm.dialogVisible=false
									
										} else {
											VueUI.$message.error("密码错误");
										}
										
									})
								} else {
									console.log('error submit!!==');
									return false;
								}
							});
						},
						ref: 'changePwdForm',
						bean: {
							pass: '',
							checkPass: '',
						},
						rules: {
							pass: [{
								required: true,
								message: '请填写旧密码',
								trigger: 'blur'
							}],
							checkPass: [{
								required: true,
								message: '请填写新密码',
								trigger: 'blur'
							}],
						},
						dialogVisible: false,
					},

					loginForm: {
						ref: 'loginForm',
						maileRef: 'registerBean',
						mailVisble: false,
						register: false,
						forgetPwd() {
							VueData().Form.loginForm.dialogVisible = false;
							VueData().Form.forgetPwdForm.dialogVisible = true;
							VueAction.JsWithVue(function () {
								swipImg.init(document.getElementById('slideImageWrap3'), function () {

								})
							})
						},
						register() {
							VueData().Form.loginForm.register = false;
							VueData().Form.loginForm.mailVisble = true;
							VueAction.JsWithVue(function () {
								swipImg.init(document.getElementById('slideImageWrap1'), function () {
									VueData().Form.loginForm.register = true;
								})
							})

						},
						registerUser() {
							if (VueData().Form.loginForm.register == false) {
								VueUI.$message.error("完成拼图验证");
								return
							}
							VueUI.$refs[VueData().Form.loginForm.maileRef].validate((valid) => {
								if (valid) {
									const loading = VueUI.$loading({
										lock: true,
										text: '正在登录......',
										spinner: 'el-icon-loading',
										background: 'rgba(0, 0, 0, 0.5)'
									});
									setTimeout(() => {
										var query = new AV.Query($.Encryption.CloudTable.UserMaster)
										query.equalTo('name',VueData().Form.loginForm.registerBean.name );
										query.count().then(function (count) {
											if (count == 0) {
												registerSuperUser(loading);
											} else {
												loading.close()
												VueUI.$message.error("账户名重复");
											}
										})


									}, 1000);

								} else {
									console.log('error submit!!==');
									return false;
								}
							});


						},
						loginAdmin() {
							VueUI.$refs[VueData().Form.loginForm.ref].validate((valid) => {
								if (valid) {
				
									const loading = showLoading('正在登陆.....')
									VueAction.login(VueData().Form.loginForm.bean.name, getMd5(VueData().Form.loginForm.bean.pwd), function (flag, data) {
										loading.close();
										if (flag) {
											if (data.examine == '通过') {
												VueData().Form.loginForm.dialogVisible = false;
												$.MdManager.loginSucess(data)
												VueAction.loadGroup();
											} else {
												VueUI.$message.error("您的账号尚未审核通过");
											}

										} else {
											VueUI.$message.error("账户或密码错误");
										}
									})

								} else {

									return false;
								}
							});

						},
						registerBean: {
							name: '',
							mail: null,
						},
						bean: {
							name: '',
							pwd: '',
						},
						maileRules: {
							mail: [{
								required: true,
								message: '请输入邮箱地址',
								trigger: 'blur'
							},
							{
								required: true,
								type: 'email',
								message: '请输入正确的邮箱地址',
								trigger: 'blur'
							}
							],
							name: [{
								required: true,
								message: '请填写账号',
								trigger: 'blur'
							}],
						},

						rules: {
							name: [{
								required: true,
								message: '请填写账号',
								trigger: 'blur'
							}],
							pwd: [{
								required: true,
								message: '请填写新密码',
								trigger: 'blur'
							}],
						},
						dialogVisible: false,
					},

				},
				selectBean: {
					dialogVisible: false,

				},
				userBean: {
					dialogVisible: false,
					editableTabsValue: '1',
					remoteloading: false, //搜索选择器loading
					remoteList: [],
					powerList: {},
					isMaster: false,

					remoteChange(arg) {

						VueData().userBean.activeWindow.TableBean.seletItem.numberId = arg
						VueData().userBean.activeWindow.TableBean.seletItem.numberName = VueAction.GetUserName(VueData().userBean.remoteList,
							arg)
					},
					cancelEdit(row) {
						row.isSet = false
						if (!row.objectId) {
							VueData().userBean.activeWindow.TableBean.list.remove(row)
						}
					},
					remoteUser: function (query) {
						if (query !== '') {
							VueData().userBean.remoteloading = true;
							var helper = $.MdManager.newPageHelper($.Encryption.CloudTable.UserMaster)
							helper.contains('name', query)
							helper.getData(function (list) {
								VueData().userBean.remoteList = VueData().userBean.remoteList.concat(list);
								VueData().userBean.remoteloading = false;
							})
						}

					},
					remoteGroup: function (query) {
						if (query !== '') {
							VueData().userBean.remoteloading = true;
							var helper = $.MdManager.newPageHelper($.Encryption.CloudTable.groupTable)
							helper.contains('name', query)
							helper.getData(function (list) {
								VueData().userBean.remoteloading = false;
								VueData().userBean.allGroups = []
								list.forEach(function (value, index, arr1) {
									VueData().userBean.allGroups.push({
										groupId: value.objectId,
										groupName: value.name,
										objectId: value.objectId
									})
								})


							})
						}

					},
					editableTabs: [{
						title: '我的所有文章',
						name: '1',
						id: '0-0',
						tableData: getInitShowTableData(),
						fun: function (that) {
							VueData().userBean.activeWindow.type = 0
							if (that) {
								VueData().userBean.activeWindow.TableBean = that.tableData;
								VueData().userBean.activeWindow.MenuActive = that.id;
							}
						}
					}],
					defultOpeneds: ['0', '1'],
					tabIndex: 1,
					activeWindow: {
						type: 0, //0我的文章1我的群组文章2我的群组成员3服务器所有成员4服务器所有群组 
						MenuActive: '0-0',
						disabledWrite: false,
						TableBean: getInitShowTableData(), //显示表格数据的实现 所有表格数据到要给它赋值才能显示
					},

					loginName: '当前未登录',
					powerLab: '(会员)',
					allGroups: [],
					//  右侧菜单对象
					leftMenuBean: {
						myGroups: [], //我加入的群组
						owerFileTags: [{ //顶部二级菜单
							name: '我的所有文章',
							type: '0'
						}, {
							name: '我的公开文章',
							type: '1'
						}, {
							name: '我的私有文章',
							type: '2'
						}],
					},
				},
				//后面的我早晚要干掉你
				totlePage: 0,
				mdOverWatchEnable: false,
				mdOverWatchData:{},

			}
		},
		created: function () {
			$.MdManager.initMd();
			//$.MdManager.initMouse();
			$.MdManager.initCloud();
			$("#scrolBtn").hide();
			
		}

	})

	function chartBtn() {
		VueData().dialogVisible = true;
	};
	function up() {
		$("#scrolBtn").hide();
		$.MdManager.scrolTop()
	};
	
	function VueData() {
		return VueUI._data;
	}

	function getInitShowTableData() {
		let data = new tableData();
		data.whereBuilder = function (it) {
			it.DbHelper.equalTo('UserId', $.Encryption.user.bean.name)
			it.DbHelper.contains('name', it.nameinput)
			return it.DbHelper
		}

		return data
	}
	//获取访客文档数据
	function getCustomerTableData() {
		let data = new tableData();
		data.whereBuilder = function (it) {
			// it.DbHelper.equalTo('groupId', $.Encryption.CloudTable.MainCode.customer.groupId)//仅显示访客组
			it.DbHelper.equalTo('power', '2')
			it.DbHelper.contains('UserId', it.nameinput)
			return it.DbHelper
		}
		return data
	}
	//获取当前tab
	function getCurrentTabs() {
		let tabs = VueData().userBean.editableTabs;
		for (let i = 0; i < tabs.length; i++) {
			if (tabs[i].id == VueData().userBean.activeWindow.MenuActive) {
				return tabs[i]
			}
		}
		return null;
	}
	//替换当前到显示的数据到数组
	function replaceCurrentTabData() {
		if (VueData().userBean.editableTabs.length == 0) {
			return
		}
		let current = getCurrentTabs();
		if (current) {
			current.tableData = VueData().userBean.activeWindow.TableBean;
		} else {
			VueUI.$message.error("当前tab发生错误");
		}
	}
	//表格数据模型
	function tableData() {
		this.nameinput = '',
			this.list = [];
		this.seletItem = {};
		this.totlePage = 0;
		this.DbName = $.Encryption.CloudTable.MdList;
		this.DbHelper;
		this.groupId = ''
		this.currentPage = 1;
		this.tagType = ['', 'success', 'info', 'warning', 'danger']
		this.whereBuilder = function (Helper) {
			return Helper;
		}
		this.tagTypeIndex = 0;
		var that = this;
		this.action = {
			// 
			addItem: function (bean) {
				if (VueAction.isTablEditor(bean.list)) {
					VueUI.$message.error("当前列表有内容正在编辑");
					return
				}
				let itemValue = {
					isSet: true,
					groupId: bean.groupId,
					groupName: bean.groupName,
					timeString: new Date().Format("yyyy-MM-dd HH:mm")
				}
				bean.seletItem = itemValue
				bean.list.unshift(itemValue)
			},
			removeTag(array, tag) {
				array.remove(tag)
			},
			selectTagType(tag) {
				tag.type = that.tagType[(++that.tagTypeIndex) % (that.tagType.length)];
			},
			addTag(array) {

			},
			saveChange: function (row) {
				//提交数据
				if (row.isSet) {
					let seletItem = VueData().userBean.activeWindow.TableBean.seletItem;
					let objId = seletItem.objectId;
					if (seletItem.groupId)
						seletItem.groupName = VueAction.getGroupNameFromArr(VueData().userBean.allGroups, seletItem.groupId)
					row.isSet = false
					if (!objId) {
						$.MdManager.newSaveHelper(VueData().userBean.activeWindow.TableBean.DbName)
							.setObj(seletItem).save(function (_obj) {
								Vue.set(row, 'objectId', _obj.id)
								VueUI.$notify({
									title: '成功',
									message: '添加成功',
									type: 'success'
								});
							})
					} else {

						$.MdManager.newSaveHelper(VueData().userBean.activeWindow.TableBean.DbName)
							.setObj(seletItem).save(function (obj) {
								VueUI.$notify({
									title: '成功',
									message: '更新成功',
									type: 'success'
								});
							})

					}
				} else {
					if (!$.Encryption.power.havePower(row)) {
						VueUI.$message.error("没有权限");
						return
					}
					if (VueAction.isTablEditor(VueData().userBean.activeWindow.TableBean.list)) {
						VueUI.$message.error("当前列表有内容正在编辑");
						return
					}
					VueData().userBean.activeWindow.TableBean.seletItem = row
					row.isSet = true;
				}
			},
			searchAction: function () {
				VueData().dialogloading = true;
				that.DbHelper = $.MdManager.newPageHelper(that.DbName);
				that.whereBuilder(that);
				that.DbHelper.current = 1;
				that.DbHelper.getData(function (result) {
					that.list = VueAction.getTransTimeStringArr(result);
					VueData().dialogloading = false;
				})
				that.DbHelper.count(function (result) {
					that.totlePage = result;
				})

			},
			executePageChange: function (index) {
				VueData().dialogloading = true;
				if (that.DbHelper == null) {
					that.DbHelper = $.MdManager.newPageHelper(that.DbName);
					that.whereBuilder(that);
				}
				that.DbHelper.current = index;
				that.DbHelper.getData(function (result) {
					that.list = VueAction.getTransTimeStringArr(result);
					VueData().dialogloading = false;
				})
				that.currentPage = index;
			},

		}
	}
	var VueAction = {
		commitEditorMd(bean, callback) {
			$.MdManager.newSaveHelper($.Encryption.CloudTable.MdList).setObj(bean).save(function (result) {
				VueUI.$notify({
					title: '成功',
					message: '保存文章成功',
					type: 'success'
				});
				if (callback) {
					callback(result)
				}
			})
		},
		cleanCatch() {
			VueData().userBean.editableTabs = [];
			VueData().userBean.activeWindow.TableBean = getInitShowTableData();
			VueData().userBean.activeWindow.type = 0
			VueData().userBean.leftMenuBean.myGroups = []
			VueAction.loadGroup()
		},
		login(name, pwd, callback) {
			let DbHelper = $.MdManager.newHelper($.Encryption.CloudTable.UserMaster);
			if (name.contain('@')) {
				DbHelper.equalTo('mail', name)
			} else {
				DbHelper.equalTo('name', name)
			}
			DbHelper.equalTo('pwd', pwd)
			DbHelper.getData(function (arg) {

				callback(arg.length > 0, arg[0])
			})
		},
		getGroupNameFromArr(arr, gId) {
			let obj = {};
			obj = arr.find((item) => {
				return item.groupId === gId;
			});
			if (!obj)
				return '未知分组'
			return obj.groupName;
		},
		GetUserName(arr, gId) {
			let obj = {};
			obj = arr.find((item) => {
				return item.objectId === gId;
			});
			if (!obj)
				return '未知'
			return obj.name;
		},
		sendMail(str, to) {
			Email.send({
				Host: "smtp.qq.com",
				Username: "1091425078@qq.com",
				Password: "zhu.1992229",
				To: to,
				From: "1091425078@qq.com",
				Subject: "审核通过",
				Body: str

			}).then(
				message => {
					VueUI.$notify({
						title: '提示',
						message: message,
						type: 'success'
					});
				}
			);
		},
		JsWithVue: function (fun) {
			setTimeout(fun, "10");
		},
		getTransTimeStringArr: function (array) {
			var resArry = array.map(function (item, index, array) {
				item.isSet = false
				item.timeString = VueAction.getTime(item.createdAt)
				return item;
			})
			return resArry;
		},
		getTime: function (time) {
			return new Date(time).Format("yyyy-MM-dd HH:mm");
		},
		addTab: function (name, fun, key, mData) {
			let newTabName = ++(VueData().userBean.tabIndex) + '';
			VueData().userBean.editableTabs.push({
				id: key,
				title: name,
				name: newTabName,
				fun: fun,
				tableData: mData,

			});
			VueData().userBean.editableTabsValue = newTabName;
			return VueData().userBean.editableTabs.lastItem();
		},
		showUpload() {
			VueData().Form.upLoadForm.dialogVisible = true;
			VueData().Form.upLoadForm.isCustomer = false;
			VueData().Form.upLoadForm.bean = $.Encryption.MdData.bean

			VueData().Form.upLoadForm.disabled = !($.Encryption.power.AllowPostMd());
			console.log($.Encryption.MdData.bean)
		},
		showCustomerUpload() {
			VueData().Form.upLoadForm.dialogVisible = true;
			VueData().Form.upLoadForm.isCustomer = true;
			VueData().Form.upLoadForm.bean = $.Encryption.MdData.bean

			VueData().Form.upLoadForm.disabled = !($.Encryption.power.AllowPostMd());
			console.log($.Encryption.MdData.bean)
		},
		showSuperUser: function () {
			VueData().userBean.dialogVisible = true;
			VueAction.loadGroup();
			VueData().userBean.isMaster = $.Encryption.user.isMaster();
			VueData().userBean.powerList = $.Encryption.power
			// if (VueData().userBean.isMaster) {
			// 	VueData().userBean.activeWindow.disabledWrite = false;
			// }
		},
		isTablEditor: function (arry) { //判断当前表是否在编辑状态
			for (let i = 0; i < arry.length; i++) {
				if (arry[i].isSet) {
					return true;
				}
			}
			return false
		},
		hide: function () {
			VueData().customerBean.dialogVisible = true;
		},
		loadGroup: function (flag) {
			if ($.Encryption.user.bean.name == null) {
				return
			}

			$.MdManager.newHelper($.Encryption.CloudTable.groupNumber).equalTo('numberName', $.Encryption.user.bean.name).getData(
				function (list) {
					VueData().userBean.leftMenuBean.myGroups = list;
					$.Encryption.user.groups = list;
					VueData().userBean.allGroups = list.clone();
					VueData().userBean.allGroups.push($.Encryption.CloudTable.MainCode.customer);
				})
		},
		showCustomerCloud: function () {
			VueData().customerBean.dialogVisible = true;
		},
		loadedList: function (arry) {
			if (VueData().customerBean.dialogVisible) {
				VueData().customerBean.openListData = arry;
			} else if (VueData().userBean.dialogVisible) {
				VueData().userBean.activeWindow.TableBean.list = arry;
			}
			VueData().dialogloading = false;
		}
	}
	function showLoading(msg) {
		let loading = VueUI.$loading({
			lock: true,
			text: msg,
			spinner: 'el-icon-loading',
			background: 'rgba(0, 0, 0, 0.5)'
		});
		return loading

	}
	function registerSuperUser(loading) {
		$.MdManager.newSaveHelper($.Encryption.CloudTable.UserMaster)
			.setObj({
				name: VueData().Form.loginForm.registerBean.name,
				mail: VueData().Form.loginForm.registerBean.mail
			}).save(function (result) {
				loading.close();
				VueUI.$notify({
					title: '提示',
					message: '注册成功',
					type: 'success'
				});
			})
	}